import { get, post } from '@/utils/axios'

const prefixUrl = '/sys/menu/'

/** 菜单树 */
export const getMenuTree = () => {
  return get(`${prefixUrl}getTree`)
}

/** 菜单表格 */
export const getMenuAll = () => {
  return get(`${prefixUrl}getMenuAll`)
}

/** 保存表单 */
export const saveMenu = (data) => {
  // 标示位转换
  data.isDelete = data.isDelete ? 1 : 0
  return post(`${prefixUrl}saveMenu`, data)
}

/** 删除菜单 */
export const deleteMenu = (menuId) => {
  return post(`${prefixUrl}delete`, { menuId })
}

/** 获取表单信息 */
export const getMenuInfo = (menuId) => {
  return get(`${prefixUrl}getMenuById`, { menuId })
}
